import { userAccountLogin } from '@/api/user'
export default {
  namespaced: true,
  state: {
    profile: {}
  },
  mutations: {
    setProfile (state, userInfo) {
      state.profile = userInfo
    },
    removeProfile (state) {
      state.profile = {}
    }
  },
  actions: {
    // 异步获取数据
    async doLogin (ctx, { account, password }) {
      const res = await userAccountLogin({ account, password })
      ctx.commit('setProfile', res.result)
    }
  }
}
